import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import router from './router'
// import '@/assets/styles/index.scss' // global css
import "@/assets/style/reset.css";
import "@/assets/style/index.scss";
import "@/assets/style/ruoyi.scss";

import store from './store'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import Myfun from './common/common.js';
console.log("环境变量=>", import.meta.env)
const app = createApp(App);
app.directive('has', {
    beforeMount: function (el, binding) {
        // .getItem('actionList');
        let actionList = store.state.actionList
        let value = binding.value;
        let hasPermission = actionList.includes(value)
        if (!hasPermission) {
            el.style = 'display:none';
            setTimeout(() => {
                el.parentNode.removeChild(el);
            }, 0)
        }
    }
})
app.use(store).use(router).use(Myfun).use(ElementPlus, { size: 'small' }).mount('#app')

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }